package com.tarena.day0917;

public class RectDemo {

	
	public static void main(String[] args) {
		test();//调用test()方法
		testEquals();
		

	}
	public static void testEquals(){
		Rect r1=new Rect();
		r1.setLocation(100, 200);
		r1.setSize(50, 50);
		Rect r2=new Rect();
		r2.setLocation(100, 200);
		r2.setSize(50, 50);
		Rect r3=r2;
		System.out.println(r1==r2);//false
		System.out.println(r3==r2);//true
		//==比较的是变量的值，只能比较“引用对象”的值
		//是比较引用对象的地址值	
		}
	public static void test(){
		Rect r1=new Rect();
		System.out.println(r1.x);//0
		System.out.println(r1);//默认调用toString()方法//0,0,0,0
		System.out.println(r1.toString());//0,0,0,0
		r1.x=100;
		r1.y=200;
		r1.width=50;
		r1.height=50;
		System.out.println(r1);//100,200,50,50
		Rect r2=new Rect();
		r2.setLocation(160, 300);
		r2.setSize(30, 30);
		System.out.println(r2);//160,300,30,30
		
	}
}
